Python Installation Linux

Concept

eCognition provides support for the execution of Python programs. The implementation is based on Python Version 3.10.11 (Python Software Foundation, https://www.python.org/) and offers the ability to perform image analysis, data management and more tasks using Python scripts.

Prerequisite

To use Python scripts in eCognition you need a valid eCognition Developer license and the latest eCognition License Server.

The eCognition installation for Linux comprises the following python libraries/packages:

Manage Python Environments

There are two ways to select a python environment:

  1. Change the 'general -> Python default environment' variable to a different environment path in eCognition.cfg

  2. Option only available for DIACmdEngine: Set the --virtual-env=path command line argument in DIACmdEngine (if this argument is set it will take precedence over the environment that is set in the eCognition.cfg)

 

Extend the base eCognition-env environment using the following steps:

1. Activation: source "/opt/eCognition Cmd Client 10.4.0/bin/Python/eCognition-env/bin/activate" -> Activate the environment.
For example: source "/opt/eCognition Cmd Client 10.4.0/bin/Python/eCognition-env/bin/activate"

2. Use pip to install new packages. For example: pip install numpy

If any of the changes destroy this environment, it is necessary to reinstall eCognition to fix it.

 

Creation of a new environment:

To create new environment you have to use eCognition's python installation.

For example: "/opt/eCognition Cmd Client 10.3.0/bin/Python/Python/bin/python3" -m venv /home/env.

Afterwards, that environment can be activated "source /home/env/bin/activate". Please use pip to install packages.

eCognition requires 3 packages installed: Numpy, Pandas and Shapely. Without them the environment will not work in eCognition.

See also:

Reference Book > Algorithms and Processes > Miscellaneous > Python Script - description algorithm and its parameters

Reference Book > Algorithms and Processes > Miscellaneous > Python API Reference - reference for each class, properties and methods

User Guide > Python Integration - application examples for python scripts

Installation Guide > Windows > Python Installation - installation and setup